﻿using Gman.WebApp.ServiceControllers;
using System.Web.Mvc;

namespace Gman.WebApp.Models
{
    public abstract class BaseModel
    {
        public SelectListItem seleccione = new SelectListItem() { Text = "Seleccione ...", Value = "Seleccione" };

        private GestionServiceController gestionServiceController = null;
        public GestionServiceController GestionServiceController
        {
            get
            {
                if (gestionServiceController == null)
                    gestionServiceController = new GestionServiceController();
                return gestionServiceController;
            }
            set
            {
                gestionServiceController = value;
            }
        }

        private GeneralServiceController generalServiceController = null;
        public GeneralServiceController GeneralServiceController
        {
            get
            {
                if (generalServiceController == null)
                    generalServiceController = new GeneralServiceController();
                return generalServiceController;
            }
            set
            {
                generalServiceController = value;
            }
        }


        private OperacionServiceController operacionServiceController = null;
        public OperacionServiceController OperacionServiceController
        {
            get
            {
                if (operacionServiceController == null)
                    operacionServiceController = new OperacionServiceController();
                return operacionServiceController;
            }
            set
            {
                operacionServiceController = value;
            }
        }


        public int PaginaActual { get; set; }

        public int UltimaPagina { get; set; }

        public BaseModel()
        {
            PaginaActual = 1;
            UltimaPagina = 1;
        }

        public BaseModel(int paginaActual, int ultimaPagina)
        {
            PaginaActual = paginaActual;
            UltimaPagina = ultimaPagina;
        }

        public bool EsUltimaPagina
        {
            get
            {
                return PaginaActual == UltimaPagina;
            }
        }

        public bool PrimeraPagina
        {
            get
            {
                return PaginaActual == 1;
            }
        }
    }
}